home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld Secrets (4th Edition)
/
Mac Secrets CD 4th Ed.toast
/
Apple Advanced Technologies
/
Apple Speech Technologies 1.5
/
PlainTalk Developer Info
/
Speech Recognition Manager SDK
/
SR Sample Code
/
Speakable Items Example
/
Sources
/
Process & Finder Stuff
/
AppleEventUtils.c
next >
Wrap
Text File
|
1995-06-07
|
2KB
|
80 lines
#pragma segment AppleEventUtils
#include "Processes.h"
#include "AppleEvents.h"
/*****************************************************************************************/
OSErr GetProcessLocation(StringPtr prompt,
LocationNameRec *theLocation,
PortInfoRec *thePortInfo);
OSErr SendAppleEvent1Param(LocationNameRec *theLocation,
PortInfoRec *thePortInfo,
AEEventClass eventClass,
AEEventID eventID,
DescType dataType,
void *dataPtr,
Size dataSize);
/*****************************************************************************************/
/*****************************************************************************************/
OSErr GetProcessLocation(prompt,
theLocation,
thePortInfo)
StringPtr prompt;
LocationNameRec *theLocation;
PortInfoRec *thePortInfo;
{
OSErr err;
err = PPCBrowser(prompt, prompt, false, theLocation, thePortInfo, (PPCFilterUPP) 0, (ConstStr32Param) 0);
return(err);
}
/*****************************************************************************************/
OSErr SendAppleEvent1Param(theLocation, thePortInfo,
eventClass, eventID,
dataType, dataPtr, dataSize)
LocationNameRec *theLocation;
PortInfoRec *thePortInfo;
AEEventClass eventClass;
AEEventID eventID;
DescType dataType;
void *dataPtr;
Size dataSize;
{
OSErr err,err2;
TargetID theTargetID;
AppleEvent theAevt;
AEAddressDesc theTarget;
theTargetID.location = *theLocation;
theTargetID.name = thePortInfo->name;
err = AECreateDesc(typeTargetID, (Ptr)&theTargetID, (Size)sizeof(theTargetID), &theTarget);
if (err == noErr)
err = AECreateAppleEvent(eventClass, eventID, &theTarget, kAutoGenerateReturnID, kAnyTransactionID, &theAevt);
if ((err == noErr) && (dataPtr != 0))
err = AEPutParamPtr(&theAevt, keyDirectObject, dataType, (Ptr) dataPtr, dataSize);
if (err == noErr)
err = AESend(&theAevt, (AppleEvent *)0, kAEQueueReply+kAECanInteract + kAECanSwitchLayer, kAENormalPriority, 240, (AEIdleUPP) 0, (AEFilterUPP)0);
/* Get rid of structures */
err2 = AEDisposeDesc(&theAevt);
err2 = AEDisposeDesc(&theTarget);
return(err);
}
/*****************************************************************************************/